What does the ".align" x86 Assembler directive do exactly? [migrated]
Posted
by
Sinister Clock
on Programmers
See other posts from Programmers
or by Sinister Clock
Published on 2013-06-25T19:42:36Z
Indexed on
2013/06/25
22:28 UTC
Read the original article
Hit count: 215
assembly
I will list exactly what I do not understand, and show you the parts I can not understand as well.
First off,
The .Align Directive
- .align integer, pad. The .align directive causes the next data generated to be aligned modulo integer bytes
1.~ ? : What is implied with "causes the next data generated to be aligned modulo integer bytes?" I can surmise that the next data generated is a memory-to-register transfer, no? Modulo would imply the remainder of a division. I do not understand "to be aligned modulo integer bytes".......
What would be a remainder of a simple data declaration, and how would the next data generated being aligned by a remainder be useful? If the next data is aligned modulo, that is saying the next generated data, whatever that means exactly, is the remainder of an integer? That makes absolutely no sense.
What specifically would the .align, say, .align 8
directive issued in x86 for a data byte compiled from a C char
, i.e., char CHARACTER = 0;
be for? Or specifically coded directly with that directive, not preliminary Assembly code after compiling C? I have debugged in Assembly and noticed that any C/C++ data declarations, like chars
, ints
, floats
, etc. will insert the directive .align 8
to each of them, and add other directives like .bss
, .zero
, .globl
, .text
, .Letext0
, .Ltext0
.
What are all of these directives for, or at least my main asking? I have learned a lot of the main x86 Assembly instructions, but never was introduced or pointed at all of these strange directives. How do they affect the opcodes, and are all of them necessary?
© Programmers or respective owner